package com.gtallinone.client;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ClickEvent;

public class JobPanel extends DockPanel{
	
	VerticalPanel mainPanel, homePanel, ap, adp, ip, idp, op, odp;
	
	public JobPanel(){
		setSize("100%", "100");
		setBorderWidth(5);
		
		//Main Panel
		mainPanel = new VerticalPanel();
		
		//Home Panel
		homePanel = new VerticalPanel();
		mainPanel.add(homePanel);
		add(mainPanel, DockPanel.CENTER);
		Label jobHome = new Label("Job opportunities at Tech!");
		jobHome.addStyleName("panelTitle");
		HorizontalPanel imagesP = new HorizontalPanel();
		Image image_Job1 = new Image("http://media.independentmail.com/media/img/photos/2010/01/27/0128JobFair079_t607.jpg");
		image_Job1.setSize("220px", "200px");
		imagesP.add(image_Job1);
		Image image_Job2 = new Image("http://www.articlesweb.org/blog/wp-content/uploads/2011/11/evaluation-of-the-growth-of-the-professional-in-your-company-121.png");
		image_Job2.setSize("220px", "200px");
		imagesP.add(image_Job2);
		Image image_Job3 = new Image("http://blog.ultradns.com/wp-content/uploads/2011/08/Professionalservices.jpg");
		image_Job3.setSize("220px", "200px");
		imagesP.add(image_Job3);
		Image image_Job4 = new Image("http://moonlitemaids.com/images/ki.bmp");
		image_Job4.setSize("220px", "200px");
		imagesP.add(image_Job4);
		
		homePanel.add(jobHome);
		homePanel.add(imagesP);
		
		//Announcement Panel
		ap = new VerticalPanel();
		Label apTitle = new Label("Announcements");
		ap.add(apTitle);
		
		apTitle.addStyleName("panelTitle");
		Image imageBar1 = new Image("http://www.cityu.edu.hk/webimage/line/grad.gif");
		imageBar1.setSize("880px", "3px");
		ap.add(imageBar1);
		
		Button skip1 = new Button("Google Tech Talk");

		FlexTable flexTable = new FlexTable();
	    flexTable.setWidget(0, 0, new Label("Date"));
	    flexTable.setWidget(0, 1, new Label("Title"));
	    flexTable.setWidget(0, 2, new Label("Author"));
	    flexTable.setWidget(1, 0, new Label("2011-12-01"));
	    flexTable.setWidget(1, 1, new Button("Facebook info session"));
	    flexTable.setWidget(1, 2, new Label("root"));
	    flexTable.setWidget(2, 0, new Label("2011-12-03"));
	    flexTable.setWidget(2, 1, skip1);
	    flexTable.setWidget(2, 2, new Label("root"));
	    flexTable.setStyleName("panel flexTable");
		ap.add(flexTable);
		
		skip1.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				mainPanel.remove(0);
				mainPanel.add(adp);
			}
		});
		
		//Announcement Detail Panel
		adp = new VerticalPanel();
	
		Label adpTitleData = new Label("Google Tech Talk");
		Label adpAuthorData = new Label("root");
		Label adpDateData = new Label("2011-12-03");
		Label adpDetailData = new Label("details coming soon");
		
		Label adpTitle = new Label("Announcement Detail");
		adp.add(adpTitle);
		adpTitle.addStyleName("panelTitle");
		
		Image imageBar2 = new Image("http://www.cityu.edu.hk/webimage/line/grad.gif");
		imageBar2.setSize("880px", "3px");
		adp.add(imageBar2);
		
		adp.add(new Label("Title: "));
		adp.add(adpTitleData);
		adp.add(new Label("Author: "));
		adp.add(adpAuthorData);
		adp.add(new Label("Date: "));
		adp.add(adpDateData);
		adp.add(new Label("Detail: "));
		adp.add(adpDetailData);
		
		Button adpBack = new Button("Back To Announcements");
		adp.add(adpBack);
		adpBack.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				mainPanel.remove(0);
				mainPanel.add(ap);
			}
		});
		
		//Info Session Panel
		ip = new VerticalPanel();
		
		Label ipTitle = new Label("Information Session");
		ip.add(ipTitle);
		
		ipTitle.addStyleName("panelTitle");
		Image imageBar3 = new Image("http://www.cityu.edu.hk/webimage/line/grad.gif");
		imageBar3.setSize("880px", "3px");
		ip.add(imageBar3);
		
		Button skip2 = new Button("Google campus info session");
		
		FlexTable flexTable2 = new FlexTable();
		flexTable2.setWidget(0, 0, new Label("Date"));
		flexTable2.setWidget(0, 1, new Label("Starting Time"));
		flexTable2.setWidget(0, 2, new Label("Title"));
		flexTable2.setWidget(0, 3, new Label("Author"));		
		flexTable2.setWidget(1, 0, new Label("2011-12-12"));
	    flexTable2.setWidget(1, 1, new Label("10:00:00"));
	    flexTable2.setWidget(1, 2, skip2);
		flexTable2.setWidget(1, 3, new Label("root"));	
	    flexTable2.setStyleName("panel flexTable");
		ip.add(flexTable2);
		
		skip2.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				mainPanel.remove(0);
				mainPanel.add(idp);
			}
		});
		
		//Info Session Detail Panel
		idp = new VerticalPanel();
		
		Label idpTitleData = new Label("Google campus info session");
		Label idpDateData = new Label("2011-12-12");
		Label idpStartTimeData = new Label("10:00:00");
		Label idpEndTimeData = new Label("11:00:00");
		Label idpLocation = new Label("Klaus");
		Label idpDetailData = new Label("coming soon");
		
		Label idpTitle = new Label("Information Session Detail");
		idp.add(idpTitle);
		idpTitle.addStyleName("panelTitle");
		
		Image imageBar4 = new Image("http://www.cityu.edu.hk/webimage/line/grad.gif");
		imageBar4.setSize("880px", "3px");
		idp.add(imageBar4);
		
		idp.add(new Label("Title: "));
		idp.add(idpTitleData);
		idp.add(new Label("Date: "));
		idp.add(idpDateData);
		idp.add(new Label("Start Time: "));
		idp.add(idpStartTimeData);
		idp.add(new Label("End Time: "));
		idp.add(idpEndTimeData);
		idp.add(new Label("Location: "));
		idp.add(idpLocation);
		idp.add(new Label("Detail: "));
		idp.add(idpDetailData);
		
		Button idpBack = new Button("Back To Open Positions");
		idp.add(idpBack);
		idpBack.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				mainPanel.remove(0);
				mainPanel.add(ip);
			}
		});
		
		//Open Position Panel
		op = new VerticalPanel();
		
		Label opTitle = new Label("Open Positions");
		op.add(opTitle);
		
		opTitle.addStyleName("panelTitle");
		Image imageBar5 = new Image("http://www.cityu.edu.hk/webimage/line/grad.gif");
		imageBar5.setSize("880px", "3px");
		op.add(imageBar5);
		
		Button skip3 = new Button("research intern");

		FlexTable flexTable3 = new FlexTable();
		flexTable3.setWidget(0, 0, new Label("Due Date"));
		flexTable3.setWidget(0, 1, new Label("Title"));
		flexTable3.setWidget(0, 2, new Label("Company"));
		flexTable3.setWidget(1, 0, new Label("2011-12-01"));
		flexTable3.setWidget(1, 1, skip3);
		flexTable3.setWidget(1, 2, new Label("Oak Ridge National Lab"));
		flexTable3.setStyleName("panel flexTable");
		op.add(flexTable3);
		
		skip3.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				mainPanel.remove(0);
				mainPanel.add(odp);
			}
		});
		
		//Open Position Detail Panel
		odp = new VerticalPanel();
		
		Label odpTitleData = new Label("research intern");
		Label odpCompanyData = new Label("Oak Ridge National Lab");
		Label odpDueDateData = new Label("2011-12-10 23:59:59");
		Label odpDetailData = new Label("please apply online");
		
	
		Label odpTitle = new Label("Open Positions Detail");
		odp.add(odpTitle);
		odpTitle.addStyleName("panelTitle");
		
		Image imageBar6 = new Image("http://www.cityu.edu.hk/webimage/line/grad.gif");
		imageBar6.setSize("880px", "3px");
		odp.add(imageBar6);
		
		
		odp.add(new Label("Title: "));
		odp.add(odpTitleData);
		odp.add(new Label("Company: "));
		odp.add(odpCompanyData);
		odp.add(new Label("Due Date: "));
		odp.add(odpDueDateData);
		odp.add(new Label("Detail: "));
		odp.add(odpDetailData);
		

		Button odpBack = new Button("Back To Open Positions");
		odp.add(odpBack);
		odpBack.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				mainPanel.remove(0);
				mainPanel.add(op);
			}
		});
		
		
		//Side Panel and Buttons
		VerticalPanel sidePanel = new VerticalPanel();
		add(sidePanel, EAST);
		Button btnHome = new Button("Home");
		btnHome.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				mainPanel.remove(0);
				mainPanel.add(homePanel);
			}
		});
		Button btnAnnoun = new Button("Announcements");
		btnAnnoun.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				mainPanel.remove(0);
				mainPanel.add(ap);
			}
		});
		Button btnInfo = new Button("Information Session");
		btnInfo.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				mainPanel.remove(0);
				mainPanel.add(ip);
			}
		});
		Button btnOpen = new Button("Open Positions");
		btnOpen.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				mainPanel.remove(0);
				mainPanel.add(op);
			}
		});
		btnHome.setSize("100%", "100%");
		btnAnnoun.setSize("100%", "100%");
		btnInfo.setSize("100%","100%");
		btnOpen.setSize("100%", "100%");
		sidePanel.add(btnHome);
		sidePanel.add(btnAnnoun);
		sidePanel.add(btnInfo);
		sidePanel.add(btnOpen);
	}
}
